import { withRouter } from 'next/router';
import Link from 'next/link';
import { Row, Col } from 'antd';
import Head from './Head';
import Search from './Search';
import Cart from './Cart';
import Nav from './Nav';
import Banner from './Banner';
import logImg from '@/public/logo/white.gif';

const Header = ({ router }) => {

    // 在首页
    const isIndex = router.pathname === '/';

    return (
        <header className={`header ${isIndex ? 'header-banner' : ''}`}>
            <Head />
            <div className="content">
                <div className="max-content">
                    <Row>
                        <Col span={7}>
                            <Link href="/">
                                <a className="logo" title="西藏旅游股份有限公司">
                                    <img src={process.env.basePath + logImg.src} alt="" />
                                </a>
                            </Link>
                        </Col>
                        <Col span={11}><Search /></Col>
                        <Col span={6}><Cart /></Col>
                    </Row>
                </div>
            </div>
            <Nav />
            { isIndex ? <Banner /> : '' } 
        </header>
    )
}
export default withRouter(Header)